#ifndef MOTIONFORM_H
#define MOTIONFORM_H

#include <QWidget>

#include "motorstatusview.h"
//#include "mccontrollerinterpreter.h"

class McControllerInterpreter;
class BallJoyStick;

namespace Ui {
class MotionForm;
}

class MotionForm : public QWidget
{
    Q_OBJECT

public:
    explicit MotionForm(McControllerInterpreter* mcInterpreterIn, int robotIdIn, bool isAutoSaveWaveIn,
                        QWidget *parent=0);
    ~MotionForm();
public:
    int showThisDialog();
    int clearMessage();
    int startMotorWave();
    int stopMotorWave();
    void showWaveForm();
    int setDebugFlag(int debugFlagIn);


private slots:
    void timeroutslot();
    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();//drag on

    void on_pushButton_6_clicked();//exit drag

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_11_clicked();


    void on_pushButton_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_18_clicked();

    void on_pushButton_19_clicked();

    void on_pushButton_20_clicked();

    void on_pushButton_21_clicked();

    void on_pushButton_22_clicked();

    void on_checkBox_2_clicked(bool checked);

    void on_pushButton_23_clicked();

    void on_comboBox_currentIndexChanged(int index);

    void on_pushButton_24_clicked();

    void on_pushButton_25_clicked();

    void on_pushButton_26_clicked();

    void on_pushButton_27_clicked();

    void on_pushButton_28_clicked();



    void on_checkBox_timer_clicked(bool checked);

    void on_pushButton_getMessage_clicked();

    void on_pushButton_getVehicleVel_clicked();

    void on_checkBox_isVehicleJognew_clicked(bool checked);

    void on_pushButton_startNavatation_clicked();

    void on_pushButton_stopNavagation_clicked();

    void on_pushButton_rfid_write_clicked();

    void on_comboBox_maganetic_mode_currentIndexChanged(int index);

    void on_comboBox_maganetic_stop_mode_currentIndexChanged(int index);

    void on_pushButton_startMaganeticTrack_clicked();

    void on_pushButton_setTrackStopInput_clicked();

    void on_pushButton_moveToDp_virtualLine_clicked();



    void on_pushButton_moveToDp_2_clicked();

    void on_pushButton_moveToDp_virtualLine_2_clicked();

    void on_pushButton_calculateVisionMatch_clicked();

    void on_pushButton_setBaseCompareMap_clicked();

    void on_pushButton_setLocalCompareMap_clicked();

    void on_pushButton_drawVisionMatchWindow_clicked();

    void on_pushButton_setLaserMinimumIntensity_clicked();

    void on_pushButton_setMathCalculateParameter_clicked();

    void on_checkBox_pclIcpWork_clicked();

    void on_pushButton_forceUpdateAmclPartial_clicked();

    void on_pushButton_readRosPosition_clicked();

    void on_pushButton_icpInitialPosition_clicked();

    void on_pushButton_setVirtualPidMoveX_clicked();

    void on_pushButton_setVirtualPidMoveR_clicked();

    void on_pushButton_setVehicleAcceleration_clicked();

    void on_comboBox_activated(int index);

    void on_pushButton_setVMarkParameter_clicked();

    void on_pushButton_setBaseCompareMap_visionmatch_clicked();

    void on_pushButton_setLocalCompareMap_visionmatch_clicked();

    void on_pushButton_show_visionmatch_debugWindow_clicked();

    void on_pushButton_calculate_vmark_laser_clicked();

    void on_pushButton_calculate_vmark_map_clicked();

    void on_checkBox_vmark_isWork_clicked(bool checked);

    void on_pushButton_show_laser_vmark_window_clicked();

    void on_pushButton_get_amcl_position_clicked();

    void on_pushButton_detect_vmark_in_laser_clicked();

    void on_pushButton_saveVmarkFIle_clicked();

    void on_pushButton_updateVmarkInfoByFile_clicked();

    void on_pushButton_getVmakrsInfo_clicked();

    void on_pushButton_setVirtualPid_lineBias_clicked();

    void on_pushButton_setVehicleAcceleration_rotate_clicked();


    void on_checkBox_isPrintVmark_clicked(bool checked);

    void on_comboBox_2_currentIndexChanged(int index);

    void on_pushButton_setVirtualPidMoveY_clicked();

    void on_pushButton_setDebugFlag_clicked();

    void on_pushButton_setQrcodeDebugFlag_clicked();

    void on_pushButton_setQrcodeDetectPara_clicked();

    void on_pushButton_setMotionFormDebugFlag_clicked();

    void on_pushButton_setRegulator_clicked();

    void on_pushButton_setRegulatorVelocity_clicked();

    void on_pushButton_browser_wave_files_clicked();

    void on_pushButton_open_wave_file_clicked();

    void on_pushButton_replot_clicked();

    void on_pushButton_save_wave_file_clicked();

    void on_pushButton_replot_inner_clicked();

    void on_pushButton_resetRosTimeMeasure_clicked();

    void on_pushButton_initialTrack_clicked();

    void on_pushButton_trigVisionOnce_clicked();

    void on_pushButton_getTrackData_clicked();

    void on_pushButton_trackStart_clicked();

    void on_pushButton_trackEnd_clicked();

    void on_pushButton_getVisionData_clicked();

    void on_pushButton_setDebugFlag_ros_clicked();

    void on_comboBox_laserFilterType_currentIndexChanged(int index);

    void on_pushButton_setInitialPose_clicked();

    void on_pushButton_setDebugFlag_reflectMatch_clicked();

    void on_checkBox_jogAgvStart_clicked(bool checked);

    void on_pushButton_setDebugFlag_vehicleJog_clicked();

    void on_pushButton_setVirtualPid_steeringControl_clicked();

    void on_pushButton_setVmarkKalmanFilter_clicked();

    void on_pushButton_setEncoderOutput_clicked();

    void on_pushButton_setBeltTrackPara_clicked();

    void on_pushButton_setWeldWave_clicked();

    void on_pushButton_setWeldWaveStart_clicked();

    void on_pushButton_setWeldWaveEnd_clicked();

    void on_pushButton_setLineTrajMaxVelocity_clicked();

    void on_pushButton_setLineTrajMaxAcceleration_clicked();

    void on_pushButton_setJointTrajMaxVelocity_clicked();

    void on_pushButton_setJointTrajMaxAcceleration_clicked();

    void on_pushButton_setVelStyle_clicked();

    void on_pushButton_setRoatate_equiradius_clicked();

    void on_pushButton_setDragPara_clicked();

    void on_pushButton_setSegment_clicked();

    void on_pushButton_setCollisionDetectRatio_clicked();

    void on_pushButton_setCollisionTorqueBias_clicked();

    void on_pushButton_setEmcCarvingTp_clicked();

    void on_pushButton_setTraditionalTp_clicked();

    void on_pushButton_setTpNetFeedScale_clicked();

    void on_pushButton_algroCallTimeReset_clicked();

    void on_pushButton_addCircle_clicked();

private:
    int showPositionType();
    int displayLaserDriverStatus();
    int showOdometerInfo();
    int showJointFeedback();
    int showJointCommand();
    int updateVmarkPositionInworld();
    int showRosMovingStatus();
    int vehicleJog();
    int displayMaganeticSensorInfo();
    int displayRfidSensorInfo();
    int  displayMaganeticTrackInfo();
    int displayVirtualLineInfo();
    int directVelocityCommand();
    int directPositionCommand();
    int displayVehiclePosition();
    int displayVmarksInfoList();
    int displayVmarkDebugInfo();
    int displayReflectDebugInfo();
    int displayAmclDebugInfo();
    int displayQrcodeDebugInfo();
    int displayVehicleVelCommand();
    int displayVisionTrackDebugInfo();
    int displayBeltTrackDebugInfo();
    int displayRegulatorDebugInfo();

    int showDebugInfo_matchInfo(PclMatchDebugInfo matchInfo);
    int showRosApiTimeConsume();
    int showAlgroCallTime();
    int displayCu1DebugInfo();
    int displayEncoderReceiver(EncoderReceiverData infoIn);
    int displayImuData(ImuDataInfo infoIn);
    int displayEmcDebugInfo(EmcDebugInfo &infoIn);

private:
    Ui::MotionForm *ui;

private:

    McControllerInterpreter* mcInterpreter;

    MotorStatusView *motorView;
    BallJoyStick *ballJoyStick;

    QTimer *timer;
    double leftSpeedCommand;
    double rightSpeedCommand;

    QStandardItemModel* model_matchInfo;
    QStandardItemModel* model_timeConsumeInfo;
    QStandardItemModel* model_algroCallTimeInfo;
    QStandardItemModel* model_vmarksInfoInfo;
    QStandardItemModel* model_vmarksDebugInfo;
    QStandardItemModel* model_reflectDebugInfo;
    QStandardItemModel* model_amclDebugInfo;
    QStandardItemModel* model_qrcodeDebugInfo;
    QStandardItemModel* model_encoderReceiverInfo;
    QStandardItemModel* model_beltTrackDebugInfo;
    QStandardItemModel* model_regulatorDebugInfo;
    QStandardItemModel* model_imuData;
    QStandardItemModel* model_emcTpInfo;
    int jointNumer;
    int debugFlag;
    int robotId;

};

#endif // MOTIONFORM_H
